import request from '@/utils/request';

export function listRoutes() {
  return request({
    url: '/sys/menu/routes',
    method: 'get',
  });
}
/**
 * 菜单树形表格
 *
 * @param queryParams
 */
export function listMenus(queryParams) {
  return request({
    url: '/sys/menu/listTree',
    method: 'get',
    params: queryParams,
  });
}

/**
 * 获取菜单详情
 *
 * @param id
 */
export function findById(id) {
  return request({
    url: '/sys/menu/findById',
    method: 'get',
    params: {
      id: id,
    },
  });
}

/**
 * 新增菜单
 *
 * @param data
 */
export function saveMenu(data) {
  return request({
    url: '/sys/menu/save',
    method: 'post',
    data: data,
  });
}

/**
 * 删除菜单
 *
 * @param ids
 */
export function deleteMenu(ids) {
  return request({
    url: '/sys/menu/delete',
    method: 'post',
    data: {
      ids: ids.split(','),
    },
  });
}
